package com.yunsom.testdemo.design.absfactory.color;

import com.yunsom.testdemo.design.absfactory.shape.Shape;
import com.yunsom.testdemo.design.absfactory.AbstractFactory;

/**
 * @author Xbao
 * @version 1.0
 * @description
 * @date 2021/3/9 17:07
 */
public class ColorFactory extends AbstractFactory {

  @Override
  public Shape getShape(String shape) {
    return null;
  }

  @Override
  public Color getColor(String color) {
    if(color == null){
      return null;
    }

    if ("yellow".equalsIgnoreCase(color)) {
      return new Yellow();
    }
    if ("red".equalsIgnoreCase(color)){
      return new Red();
    }
    if ("blue".equalsIgnoreCase(color)){
      return new Blue();
    }
    return null;
  }
}
